<template>
	<div class="main">
		<!-- <scroller> -->

		<div class="adOuterWrap">
			<div class="back">
				<go-back aa='../evaluation/ad'></go-back>
				<h2>综合测试报告记录<b style="float: right;font-size: 0.22rem;color: #6CBF20;" v-show="flag==false"  @click="commonJs.gosto('evaluationEntry')">新的测试</b></h2>

			</div>
			<div class="adWrap">
				<scroller style="top: 1.6rem;">
					<div>
						<div class="adBoxs">
							<div class="listBox">
								<!-- <span v-show="flag" class="txtBox" @click="goto('resultDetails')" > -->
								<span v-show="flag" class="txtBox" @click="commonJs.gosto('evaluationEntry')" >
								 
									<i>您有未完成能的综合的测试</i>
									<b>点击继续</b>
								</span>
								<report-list :zhData='zhDatas'></report-list>
								
						

							</div>

						</div>
						<div style="width: 100%;height: 1.6rem;"></div>
					</div>

				</scroller>
				<!-- </div> -->
			</div>
			<!-- <div class="adBot">
				<span @click="goto('reportRecord')">进入生涯测评</span>
			</div> -->
		</div>
		<!-- </scroller> -->
	</div>
</template>
<script>
	import ls from 'store2';
	import {} from 'vux'
	import {
		format
	} from '~/plugins/filter';
	import goBack from '~/components/goBack'
	import reportList from '~/components/reportList'
	import axios1 from '~/plugins/axios1'
	export default {
		head: {
			title: '生涯测评'
		},
		components: {
			goBack,
			reportList
		},
		created() {
			this.commonJs.gologins();
		},
		data() {
			return {
			zhDatas:[],
			flag:false
			}
		},
		mounted: function() {
			this.showZongheList();
			if(this.commonJs.isTerminal()=='isAndroid'){
			if (window.history && window.history.pushState) {
				history.pushState(null, null, document.URL);
				window.addEventListener('popstate', this.fun, false); //false阻止默认事件 
			}
			}
			ls.set('preUrl','../evaluation/reportRecord')

		},					
		destroyed() {
			window.removeEventListener('popstate', this.fun, false);
		},
		watch: {

		},
		methods: {
			fun() {
				this.$router.replace({
					path: '../evaluation/ad'
				
				})
			
			},
			showResultList() {
				// let userid = 1745680;263997
				let obj = {
					userId:ls.get('userData').userId,
					userType:ls.get('userType')
				}
				axios1.post('/career/getEvaluation',obj,true).then(res => {
					if (res.code === '0') {

					}
				}).catch(() => {
					this.$vux.toast.text('数据错误');
				})

			},
			showZongheList() {
				// let userid = 263997;
				let obj = {
					// userId:ls.get('userData').userId,
					userType:ls.get('userType')
				}
				axios1.posts('/career/getReportList?userType='+ls.get('userType')).then(res => {
					if (res.code === '0') {
						let zhData = res.data;						
						// filter回调函数
						if(zhData[0].generate===0){
							this.flag=true;
						}
						var dofilter = function(element, index, array) {
							if (element.generate<1) { // 年龄过滤
								return false;
							}
							return true;
						}

						/* test */
						this.zhDatas = zhData.filter(dofilter);
						console.log('filtered',this.zhDatas)

					}
				}).catch(() => {
					this.$vux.toast.text('数据错误');
				})
			},
			goto(routerName, queryData) {
				this.$router.replace({
					path: routerName,
					query: {
						type: queryData
					}
				})
			}

		},
		beforeDestroy() {

		}

	}
</script>

<style scoped lang="less">
	.adOuterWrap {
		width: 7.5rem;
		height: 100vh;
		background: #fff;
		flex-direction: column;
		overflow: hidden;

		.adWrap {

			padding: 0 0.3rem;
			width: 7.5rem;
			box-sizing: border-box;

			.adBoxs {
				width: 100%;
				height: auto;

				.listBox {
					height: auto;
					padding: 0.3rem 0.3rem;
					box-sizing: border-box;

					.txtBox {
						display: block;
						width: 100%;
						height: 0.8rem;
						background: rgba(255, 241, 184, 1);
						border-radius: 0.1rem;
						opacity: 0.6;
						text-align: center;
						line-height: 0.8rem;

						i,
						b {
							font-size: 0.22rem;

							font-weight: bold;
							color: rgba(34, 34, 34, 1);

						}

						b {
							margin-left: 0.1rem;
							color: #6CBF20;
						}
					}

				}


			}
		}


	}

	.back {
		width: 100%;
		height: auto;

		h2 {
			padding: 0 0.3rem;
			box-sizing: border-box;
			display: block;
			height: 0.8rem;
			font-size: 0.44rem;

			font-weight: bold;
			color: rgba(34, 34, 34, 1);
			line-height: 0.8rem;
		}
	}
</style>
